import { defineStore } from 'pinia'

// 存放菜单标签的数组
export const tagViews = defineStore('tagViews', {
  state: () => ({
    tagList: [
      {
        path: '/home',
        meta: {
          title: '首页',
        },
        type: 'info',
        isActive: false,
      },
    ],
  }),
  actions: {
    // 设置路由集合
    pushTag(menu: any) {
      // @ts-ignore
      this.tagList.push(menu)
    },
    // 判断是否已经添加过此路由了
    hasTag(menu: any) {
      return this.tagList.some((item: any) => item.path === menu.path)
    },
  },
})
